home *** CD-ROM | disk | FTP | other *** search
- //
- // $Log: stuff.c,v $
- // Revision 1.4 1994/10/04 01:02:02 hakan
- // PROGDIR:-Abhängigkeit und Owner-bug beseitigt
- //
- // Revision 1.3 1994/08/15 22:54:50 hakan
- // SaveList() is fully functional.
- //
- // Revision 1.2 1994/07/12 22:18:21 hakan
- // DecodeATTNFlags and DecodeChipRevBits recreated
- //
- // Revision 1.1 1994/07/12 21:54:17 hakan
- // Initial revision
- //
- //
-
- static char* RCSId = "$Id: stuff.c,v 1.4 1994/10/04 01:02:02 hakan Exp $";
-
- #include "extern.h"
- #include <exec/execbase.h>
- #include <graphics/gfxbase.h>
-
-
-
- char* DecodeATTNFlags (long flags)
- {
- static char buf [100];
- char* p;
- char* f;
-
- p = "68000";
- if (flags & AFF_68010) p = "68010";
- if (flags & AFF_68020) p = "68020";
- if (flags & AFF_68030) p = "68030";
- if (flags & AFF_68040) p = "68040";
-
- f = "\0";
- if (flags & AFF_68881) f = ", 68881";
- if (flags & AFF_68882) f = ", 68882";
-
- sprintf (buf, "%s%s", p, f);
-
- return (buf);
- }
-
-
-
- char* DecodeChipRevBits (long flags)
- {
- static char* c;
-
-
- flags &= SETCHIPREV_AA;
-
- c = "Classic Chipset";
- if ((flags & SETCHIPREV_A) == SETCHIPREV_A) c = "Fat Agnus";
- if ((flags & SETCHIPREV_ECS) == SETCHIPREV_ECS) c = "Extended Chip Set";
- if ((flags & SETCHIPREV_AA) == SETCHIPREV_AA) c = "Advanced Amiga";
-
- return (c);
- }
-
-
-
- void SaveList (char* FileName)
- {
- FILE* outf;
- struct Node* work;
- struct List* list;
- struct Node* innerWork;
- struct List* innerList;
-
-
- if (FileName)
- {
- outf = fopen (FileName, "w");
- }
- else
- {
- outf = stdout;
- }
-
- if (!!outf)
- {
- list = Realms ();
- if (!(IsListEmpty(list)))
- {
- fprintf (outf, "Realms:\n");
-
- for (work = list->lh_Head; work->ln_Succ; work = work->ln_Succ)
- {
- fprintf (outf, " %s\n", work->ln_Name);
- }
-
- fprintf (outf, "\n");
- }
-
- list = Hosts ();
- if (!(IsListEmpty(list)))
- {
- fprintf (outf, "Hosts:\n");
-
- for (work = list->lh_Head; work->ln_Succ; work = work->ln_Succ)
- {
- Host* h = (Host*) work;
-
- if (h->HostName)
- fprintf (outf, " Hostname: %s\n", h->HostName);
-
- if (h->Owner)
- if (h->Owner[0])
- fprintf (outf, " Owner: %s\n", h->Owner);
-
- if (h->IPAddr)
- fprintf (outf, " IP-Address: %ld.%ld.%ld.%ld\n", ((h->IPAddr >> 24) & 0xff), ((h->IPAddr >> 16) & 0xff), ((h->IPAddr >> 8) & 0xff), (h->IPAddr & 0xff));
-
- if (h->KickVersion)
- fprintf (outf, " Kickstart: %ld.%ld\n", ((h->KickVersion >> 16) & 0xffff), (h->KickVersion & 0xffff));
-
- if (h->WBVersion)
- fprintf (outf, " Workbench: %ld.%ld\n", ((h->WBVersion >> 16) & 0xffff), (h->WBVersion & 0xffff));
-
- if (h->MaxFastMem)
- fprintf (outf, " Memory: %ld K Fast, %ld K Chip\n", (h->MaxFastMem) / 1024, (h->MaxChipMem) / 1024);
-
- if (h->NIPCVersion)
- fprintf (outf, " NIPC Version: %ld.%ld\n", ((h->NIPCVersion >> 16) & 0xff), (h->NIPCVersion & 0xff));
-
- if (h->ATTNFlags)
- fprintf (outf, " Processor: %s\n", DecodeATTNFlags (h->ATTNFlags));
-
- if (h->ChipRevBits)
- fprintf (outf, " Custom Chips: %s\n", DecodeChipRevBits (h->ChipRevBits));
-
- innerList = &(h->Services);
- if (!(IsListEmpty(innerList)))
- {
- long num = 0;
-
- for (innerWork = innerList->lh_Head; innerWork->ln_Succ; innerWork = innerWork->ln_Succ)
- {
- fprintf (outf, "%s%s\n", (num++) ? " " : " Services: ", innerWork->ln_Name);
- }
- }
-
- innerList = &(h->Entities);
- if (!(IsListEmpty(innerList)))
- {
- long num = 0;
-
- for (innerWork = innerList->lh_Head; innerWork->ln_Succ; innerWork = innerWork->ln_Succ)
- {
- fprintf (outf, "%s%s\n", (num++) ? " " : " Entities: ", innerWork->ln_Name);
- }
- }
-
- fprintf (outf, "\n");
- }
- }
-
- if (FileName)
- {
- fclose (outf);
- }
- }
- }
-